// TOWN SPECIAL ENCOUNTERS
//    Town 28: Castle Troglo

beginzonescript;

variables;

short im_hostile = 0;
short max_crime = 200;
short last_abil;
short counter = 0;
short set_ter = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

//	set_name(,);
//	add_range_to_group(,,groupn);

	set_personality_name(560,"King Vothkaro");

	set_crime_tolerance(max_crime);

	if (gf(28,13) > 0) 
		make_zone_hostile();
	if (gf(28,8) >= 7) 
		make_zone_hostile();
	
	if (gf(28,8) < 6)
		sf(28,20,0);
		else sf(28,20,1);
	break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(2803,"His agents will find you soon.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(2803,"We must work quickly.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(2803,"Elhioc is mad.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(2803,"Elhioc abandons our ways.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(2803,"We will fight our true enemy.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(2803,"I am still king here!");


	// in cell
	if (gf(28,7) > 1)
		inc_flag(28,7,-1);
	if (gf(28,7) == 1) {
		sf(28,7,0);
		sf(28,20,1);
		if (gf(28,8) < 2) {
			sf(28,8,2);
			ok_dlog(65,2);
			}
			else {
				if (gf(28,8) == 2)
					sf(28,8,3);
				ok_dlog(68,1);
				
				}
		}
		
	if ((get_terrain(0,52,51) != 0) && (gf(28,8) >= 5))
		set_terrain(0,52,51,0);
	if ((get_terrain(0,57,53) != 0) && (gf(28,12) > 0)) {
		set_terrain(0,57,53,0);
		set_terrain(0,57,54,0);
		}
		
	if (gf(28,6) > 0) {
		radiate_ground_effect(60,15,4,3,2);
		}
break;

beginstate 10;
break;

beginstate 11;
break;

beginstate 12;
break;

beginstate 13;
break;

beginstate 14;
break;

//	print_str("");
//	set_terrain_string_range("",1);
//	set_terrain_string_range("The sign says - .",1);

